#include <stdio.h>
#include <string.h>



#define MAXSYMTBENTRIES 0x10000
int symtab[MAXSYMTBENTRIES][4];
int symtab_nextentry = 1;

#define MAXLEXTAPESIZ	0X10000
char lextape[MAXLEXTAPESIZ];
int lextape_nextentry = 0;







/*índice , symbol , type , category */

int symtab_insert(char const *symbol, int dtype, int objtype, int formaparms, char const *regparms )
{
  symtab[symtab_nextentry][0] = lextape_nextentry;
  symtab[symtab_nextentry][1] = dtype;
  symtab[symtab_nextentry][2] = objtype;
  symtab[symtab_nextentry][3] = formaparms;
  symtab[symtab_nextentry][4] = regparms;
  strcpy(lextape + lextape_nextentry, symbol);
  lextape_nextentry += strlen(symbol)+1;
  return symtab_nextentry++;
}

int symtab_lookup(char const *symbol)
{
  int i;
  for (i=symtab_nextentry-1;i>0; i--){
    if(strcmp(lextape+symtab[i][0], symbol)==0)return i;
  }
  return 0;    
}